package com.hospital.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hospital.common.domain.system.UserInfo;
import com.hospital.system.mapper.UserMapper;
import com.hospital.system.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Author：sjc
 * @Description:
 * @name：UserServiceImpl
 * @Date：2024/10/18 18:58
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, UserInfo> implements UserService {
    @Autowired
    private UserMapper userMapper;

    /**
     * 登录
     * @param patient
     * @return
     */
    @Override
    public UserInfo findUser(UserInfo patient) {
        UserInfo patient1 = userMapper.selectOne(new QueryWrapper<UserInfo>().lambda()
                .eq(UserInfo::getAccount, patient.getAccount())
                .eq(UserInfo::getPassword, patient.getPassword()));
        return patient1;
    }

    /**
     * 根据账号查询用户
     * @param patientName
     * @return
     */
    @Override
    public UserInfo selectUser(String patientName) {
        UserInfo patientVo1 = userMapper.selectOne(new QueryWrapper<UserInfo>().lambda()
                .eq(UserInfo::getAccount, patientName));

        return patientVo1;
    }
}
